package com.gupao.strategydemo.orderpay;

import com.gupao.strategydemo.orderpay.payport.PayType;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

@Data
public class Order {
    private String uid;
    private String orderId;
    private BigDecimal amount;

    public Order(String uid,String orderId,BigDecimal amount){
        this.uid=uid;
        this.orderId=orderId;
        this.amount=amount;
    }


    /**
     * 无需通过switch case或者if-else代码去实现
     */
    public PayState pay(Payment payment){
        return payment.pay(this.uid,this.amount);
    }
}
